Telegram Group & Telegram Channel
Работаем с картинками в Python

Библиотека Pillow — это очень мощный, быстрый и удобный инструмент для обработки графики в Python.

В сегодняшнем примере мы применим ее для конвертации картинки в черно-белую, обратим цвета, вертикально отзеркалим и сохраним в файл.

Метод Image.open('resources/img/cat.jpg') считывает картинку из папки.

img.convert('L') трансформирует картинку в черно-белую.

ImageOps.invert(image) обращает цвета.

img.transpose(Image.FLIP_LEFT_RIGHT) вертикально отзеркаливает картинку.

img.save('grayscale_cat.jpg') сохранит картинку на диске.

Больше официальных примеров и документацию можно посмотреть тут.

Пример можно посмотреть тут.

#pillow



tg-me.com/python_academy/797
Create:
Last Update:

Работаем с картинками в Python

Библиотека Pillow — это очень мощный, быстрый и удобный инструмент для обработки графики в Python.

В сегодняшнем примере мы применим ее для конвертации картинки в черно-белую, обратим цвета, вертикально отзеркалим и сохраним в файл.

Метод Image.open('resources/img/cat.jpg') считывает картинку из папки.

img.convert('L') трансформирует картинку в черно-белую.

ImageOps.invert(image) обращает цвета.

img.transpose(Image.FLIP_LEFT_RIGHT) вертикально отзеркаливает картинку.

img.save('grayscale_cat.jpg') сохранит картинку на диске.

Больше официальных примеров и документацию можно посмотреть тут.

Пример можно посмотреть тут.

#pillow

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/797

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

The global forecast for the Asian markets is murky following recent volatility, with crude oil prices providing support in what has been an otherwise tough month. The European markets were down and the U.S. bourses were mixed and flat and the Asian markets figure to split the difference.The TSE finished modestly lower on Friday following losses from the financial shares and property stocks.For the day, the index sank 15.09 points or 0.49 percent to finish at 3,061.35 after trading between 3,057.84 and 3,089.78. Volume was 1.39 billion shares worth 1.30 billion Singapore dollars. There were 285 decliners and 184 gainers.

Why Telegram?

Telegram has no known backdoors and, even though it is come in for criticism for using proprietary encryption methods instead of open-source ones, those have yet to be compromised. While no messaging app can guarantee a 100% impermeable defense against determined attackers, Telegram is vulnerabilities are few and either theoretical or based on spoof files fooling users into actively enabling an attack.

Python Academy from in


Telegram Python Academy
FROM USA